# 读取文件
with open(file="../../data/student.txt", mode="r", encoding="utf-8") as f:
    lines = f.readlines()

clazzs = []
for line in lines:
    clazz = line.strip().split(",")[-1]
    clazzs.append(clazz)

print(clazzs)

# 列表推导式
l = [line.strip().split(",")[-1] for line in lines]
print(l)

for i in range(1, 10):
    # 循环列
    for j in range(1, i + 1):
        # 构建公式
        print(f"{j} * {i} = {j * i}", end="\t")
    # 换行
    print()

# 嵌套的列表推导式
print([i + j for i in range(10) for j in range(10)])

# 在一行中打印九九乘法表
print([f"{j} * {i} = {j * i}" for i in range(1, 10) for j in range(1, i + 1)])

# split：将一个字符串切分成一个列表
s = "1,2,3,4,5,6,7"
l = s.split(",")
print(l)

# join：通过一个分隔符将一个列表拼接成一个字符串
print("|".join(l))

# 打印九九乘法表
print("\n".join(["\t".join([f"{j} * {i} = {j * i}" for j in range(1, i + 1)]) for i in range(10)]))









